package com.aimao.blog.dao;

import com.aimao.blog.pojo.Comment;
import com.aimao.blog.vo.CommentSearchResultVo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface CommentMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Comment record);

    int insertSelective(Comment record);

    Comment selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Comment record);

    int updateByPrimaryKey(Comment record);

    IPage<Comment> selectCommentAll(Page page, @Param("articleId") Integer articleId);

    List<Comment> selectReplyAll(@Param("articleId") Integer articleId, @Param("parentId") Integer parentId);

    List<CommentSearchResultVo> selectCommentSearchList(Integer size);

    List<CommentSearchResultVo> selectCommentSearchByArticleKey(String key);

    int deleteByParentId(Integer parentId);

    int selectArticleCommentCount(Integer articleId);

    /**
     * 获取未读的消息列表
     *
     * @return
     */
    List<Comment> selectNotHandleAll();

    /**
     * 设置为 已读状态
     *
     * @param ids
     * @return
     */
    int updateCommentStatusForDone(@Param("ids") List<Integer> ids);
}